/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.bayu.services.dao;

/**
 *
 * @author joep
 */

import com.bayu.services.entity.GraphDisa;
import java.util.List;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

@Repository("graphDisaDao")
@Transactional
public class GraphDisaDao extends AbstractDao{

    @Override
    public List<GraphDisa> getAll(String query) {
        return hibernateTemplate.find(query);
    }

    @Override
    public List<GraphDisa> getAllByDate(String start, String end) {
        return hibernateTemplate.find("from GraphDisa where date between '"
            + start + "' and '" + end + "' order by date asc");
    }

    @Override
    public List<GraphDisa> getById(Long id) {
        return hibernateTemplate.find("from GraphDisa where id=" + id);
    }

    @Override
    public List<GraphDisa> getAllByMonth(String month) {
        return hibernateTemplate.find("from GraphDisa where MONTH(date)='"
            + month + "' order by date asc");
    }

    @Override
    public double getMax() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public double getMin() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

}
